<?php
$path = 'http://dwz-ria.googlecode.com/svn/trunk';
$path = 'http://j-ui.com';
$path = 'http://127.0.0.1:8091';
$path = 'public/firadio-dwz';
//下面调用getaccordion来获取菜单列表
$accordion = getaccordion($this->tables['menutree']);

function getaccordion($menus) {
    //对列表的大标签输出
    $outstr = '';
    foreach ($menus as $row) {
        $outstr.="<div class=\"accordionHeader\">\r\n";
        $outstr.="<h2><span>Folder</span>$row[title]</h2>\r\n";
        $outstr.="</div>\r\n";
        $outstr.="<div class=\"accordionContent\">\r\n";
        $outstr.="\t<ul class=\"tree treeFolder\">\r\n";
        _list($outstr, $row['sub']);
        $outstr.="\t</ul>\r\n";
        $outstr.="</div>\r\n";
    }
    return($outstr);
}

function _list(&$outstr, $rows) {
    //递归列表SUB的函数
    foreach ($rows as $row) {
        $outstr.="<li>\r\n";
        if (isset($row['sub'])) {
            $outstr.="<a>{$row['title']}</a>\r\n";
            $outstr.="<ul>\r\n";
            _list($outstr, $row['sub']);
            $outstr.="</ul>\r\n";
        } else {
            $outstr.="<a target=\"navTab\" rel=\"{$row['ctrl']}_{$row['action']}\" href=\"./?c={$row['ctrl']}&a={$row['action']}\">{$row['title']}</a>\r\n";
        }
        $outstr.="</li>\r\n";
    }
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7" />
        <title>DNS域名解析管理系统</title>

        <link href="<?php echo($path); ?>/themes/default/style.css" rel="stylesheet" type="text/css" media="screen"/>
        <link href="<?php echo($path); ?>/themes/css/core.css" rel="stylesheet" type="text/css" media="screen"/>
        <link href="<?php echo($path); ?>/themes/css/print.css" rel="stylesheet" type="text/css" media="print"/>
        <link href="<?php echo($path); ?>/uploadify/css/uploadify.css" rel="stylesheet" type="text/css" media="screen"/>
        <!--[if IE]>
        <link href="<?php echo($path); ?>/themes/css/ieHack.css" rel="stylesheet" type="text/css" media="screen"/>
        <![endif]-->
        <script src="static/js/json2.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/speedup.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/jquery-1.7.2.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/jquery.cookie.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/jquery.validate.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/jquery.bgiframe.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/xheditor/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/uploadify/scripts/swfobject.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/uploadify/scripts/jquery.uploadify.v2.1.0.js" type="text/javascript"></script>

        <!-- svg图表  supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+ -->
        <script type="text/javascript" src="<?php echo($path); ?>/chart/raphael.js"></script>
        <script type="text/javascript" src="<?php echo($path); ?>/chart/g.raphael.js"></script>
        <script type="text/javascript" src="<?php echo($path); ?>/chart/g.bar.js"></script>
        <script type="text/javascript" src="<?php echo($path); ?>/chart/g.line.js"></script>
        <script type="text/javascript" src="<?php echo($path); ?>/chart/g.pie.js"></script>
        <script type="text/javascript" src="<?php echo($path); ?>/chart/g.dot.js"></script>

        <script src="<?php echo($path); ?>/js/dwz.core.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.util.date.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.validate.method.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.regional.zh.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.barDrag.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.drag.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.tree.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.accordion.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.ui.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.theme.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.switchEnv.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.alertMsg.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.contextmenu.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.navTab.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.tab.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.resize.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.dialog.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.dialogDrag.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.sortDrag.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.cssTable.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.stable.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.taskBar.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.ajax.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.pagination.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.database.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.datepicker.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.effects.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.panel.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.checkbox.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.history.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.combox.js" type="text/javascript"></script>
        <script src="<?php echo($path); ?>/js/dwz.print.js" type="text/javascript"></script>
        <!--
        <script src="bin/dwz.min.js" type="text/javascript"></script>
        -->
        <script src="<?php echo($path); ?>/js/dwz.regional.zh.js" type="text/javascript"></script>

        <script type="text/javascript">
            function orderadd(input1,input2,input3){
                var fields=input1.split(',');
                fields.unshift(input2+' '+input3);
                fields=uniqueField(fields);
                //alert(fields.join(','));
                return(fields.join(','));
            }
            function uniqueField(data) {
                data = data || [];
                var a = {};
                for (var i = 0; i < data.length; i++) {
                    var v = data[i].split(' ');
                    if (typeof(a[v[0]]) == 'undefined') {
                        a[v[0]] = v[1];
                    }
                }
                data.length = 0;
                for (var i in a) {
                    var d=i;
                    //alert(i+'==='+a[i]+(a[i]!=undefined));
                    if (a[i]!=undefined) d+=' '+a[i];
                    data[data.length] = d;
                }
                return data;
            }
            $(function(){
                $.extend({     
                    uniqueArray:function(a) {
                        var r=[];
                        for (var i=0,l=a.length; i<l; ++i)$.inArray(a[i],r)<0&&r.push(a[i]);
                        return(r);
                    }
                });
                DWZ.init("?c=default&a=dwzfragxml", {
                    loginUrl:"login_dialog.html", loginTitle:"登录",	// 弹出登录对话框
                    //loginUrl:"login.html", // 跳到登录页面
                    statusCode:{ok:200, error:300, timeout:301}, //【可选】
                    pageInfo:{pageNum:"pageinfo[pageNum]", numPerPage:"pageinfo[numPerPage]", orderField:"order[Field]", orderDirection:"order[Direction]"}, //【可选】
                    debug:false, // 调试模式 【true|false】
                    callback:function(){
                        initEnv();
                        if (1&&$.isFunction($.cookie)){
                            var themeName = $.cookie("dwz_theme");
                            if(!themeName)themeName="azure";//azure|purple
                            $.cookie("dwz_theme", themeName);
                        }
                        $("#themeList").theme({themeBase:"<?php echo($path); ?>/themes"}); // themeBase 相对于index页面的主题base路径
                    }
                });
            });

        </script>
    </head>

    <body scroll="no">
        <div id="layout">
            <div id="header">
                <div class="headerNav">
                    <!--
                    <a class="logo" href="http://j-ui.com">标志</a>
                    <ul class="nav">
                        <li id="switchEnvBox"><a href="javascript:">（<span>北京</span>）切换城市</a>
                            <ul>
                                <li><a href="sidebar_1.html">北京</a></li>
                                <li><a href="sidebar_2.html">上海</a></li>
                                <li><a href="sidebar_2.html">南京</a></li>
                                <li><a href="sidebar_2.html">深圳</a></li>
                                <li><a href="sidebar_2.html">广州</a></li>
                                <li><a href="sidebar_2.html">天津</a></li>
                                <li><a href="sidebar_2.html">杭州</a></li>
                            </ul>
                        </li>
                        <li><a href="https://me.alipay.com/dwzteam" target="_blank">捐赠</a></li>
                        <li><a href="changepwd.html" target="dialog" width="600">设置</a></li>
                        <li><a href="http://www.cnblogs.com/dwzjs" target="_blank">博客</a></li>
                        <li><a href="http://weibo.com/dwzui" target="_blank">微博</a></li>
                        <li><a href="http://bbs.dwzjs.com" target="_blank">论坛</a></li>
                        <li><a href="login.html">退出</a></li>
                    </ul>
                    -->
                    <ul class="themeList" id="themeList">
                        <li theme="default"><div class="selected">蓝色</div></li>
                        <li theme="green"><div>绿色</div></li>
                        <!--<li theme="red"><div>红色</div></li>-->
                        <li theme="purple"><div>紫色</div></li>
                        <li theme="silver"><div>银色</div></li>
                        <li theme="azure"><div>天蓝</div></li>
                    </ul>
                </div>

                <!-- navMenu -->

            </div>

            <div id="leftside">
                <div id="sidebar_s">
                    <div class="collapse">
                        <div class="toggleCollapse"><div></div></div>
                    </div>
                </div>
                <div id="sidebar">
                    <div class="toggleCollapse"><h2>主菜单</h2><div>收缩</div></div>

                    <div class="accordion" fillSpace="sidebar">
                        <?php echo($accordion) ?>
                    </div>
                </div>
            </div>
            <div id="container">
                <div id="navTab" class="tabsPage">
                    <div class="tabsPageHeader">
                        <div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
                            <ul class="navTab-tab">
                                <li tabid="main" class="main"><a href="javascript:;"><span><span class="home_icon">我的主页</span></span></a></li>
                            </ul>
                        </div>
                        <div class="tabsLeft">left</div><!-- 禁用只需要添加一个样式 class="tabsLeft tabsLeftDisabled" -->
                        <div class="tabsRight">right</div><!-- 禁用只需要添加一个样式 class="tabsRight tabsRightDisabled" -->
                        <div class="tabsMore">more</div>
                    </div>
                    <ul class="tabsMoreList">
                        <li><a href="javascript:;">我的主页</a></li>
                    </ul>
                    <div class="navTab-panel tabsPageContent layoutBox">
                        <?php $this->display("default_home"); ?>
                    </div>
                </div>
            </div>

        </div>

        <div id="footer">Copyright &copy; 2013 <a href="http://firadio.com" target="navTab">firadio.com</a> QQ：550220138</div>

    </body>
</html>